﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using CNFM_CROCODILE_LOGO.Core.Domain.ViewModels;
using CNFM_CROCODILE_LOGO.Services.Interfaces;
using Microsoft.AspNetCore.Mvc;

namespace CNFM_CROCODILE_LOGO_Web.Controllers
{
    public class LoginController : Controller
    {
        private IUserServices _pro;

        public LoginController(IUserServices pro)
        {
            this._pro = pro;
        }

        public IActionResult Login()
        {
            return View();
        }

        /// <summary>
        /// 用户登陆
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [HttpPost]
        public JsonResult UserLogin(string LoginName, string Password)
        {
            UserModels model = new UserModels()
            {
                LoginName = LoginName,
                Password = Password
            };
            var ret = _pro.Login(model);
            return Json(ret);
        }
    }
}